<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:o="http://openfaces.org/"
				xmlns:c="http://java.sun.com/jstl/core">
	<h:form>
    	<div style="text-align:right;">
        	<div style="float:left;">
            	<!-- <h:commandButton immediate="true" action="#{locationCrud.createSetup}" value="#{msg.lblAddNew}" id="button1" /> -->

           		<!-- Paging -->	
            	<ui:include src="/snippets/paging.xhtml">
  					<ui:param name="currentCrud" value="#{locationCrud}"/>
				</ui:include>	
          	</div>
      	</div>

        <!-- Search Widget -->
        <ui:include src="/search/searchBox.xhtml">
            <ui:param name="crud" value="#{locationCrud}"/>
        </ui:include>
        <div>
          <c:if test="#{flowScope.updating == null}" >
            <h:outputText escape="false" value="#{msg.locationEmpty}" rendered="#{locationCrud.pager.totalCount == 0}" />
            <h:messages id="errors" globalOnly="true" />
            <h:panelGroup rendered="#{locationCrud.pager.totalCount > 0}">
                <h:dataTable value="#{locationCrud.pagedItems}" var="loc"
                             width="100%" columnClasses="center,center,center,width3" >
                    <h:column headerClass="width1">
                        <f:facet name="header">
                            <h:outputText value="#{msg.locationId}" />
                        </f:facet>
                        <h:outputText value="#{loc.extId}" />
                    </h:column>
                    <h:column headerClass="width1">
                        <f:facet name="header">
                            <h:outputText value="#{msg.locationName}" />
                        </f:facet>
                        <h:outputText value="#{loc.locationName}" />
                    </h:column>
                    <h:column headerClass="width1">
                        <f:facet name="header">
                            <h:outputText value="#{locationHierarchyService.lowestLevel.name}" />
                        </f:facet>
                        <h:outputText value="#{loc.locationLevel.extId}" />
                    </h:column>
                    <h:column headerClass="width3">
                        <f:facet name="header">
                            <h:outputText escape="false" value=""/>
                        </f:facet> 
                        <h:outputLink value="#{request.contextPath}/amendment/location/details/#{loc.uuid}">
                            <h:graphicImage style="border: 0;" title="details" value="/resources/icons/details.ico" />
                        </h:outputLink>
                        <h:outputText value=" "/>
                        <h:commandLink id="edit" action="#{locationCrud.editSetup}" >
                        	<f:param name="itemId" value="#{loc.uuid}"/>
                          	<h:graphicImage style="border: 0;" title="edit" value="/resources/icons/edit.ico" />
                        </h:commandLink>
						<h:commandLink action="#{locationCrud.delete}">
		                   	<h:graphicImage title="delete" style="border: 0;" value="/resources/icons/delete.ico"/>
                           	<f:param name="itemId" value="#{loc.uuid}"/>
		                </h:commandLink>
                    </h:column>
                </h:dataTable>
            </h:panelGroup>
         </c:if>
               
         <c:if test="#{flowScope.updating != null}" >
         	<h:outputText escape="false" value="#{msg.locationEmpty}" rendered="#{locationCrud.pager.totalCount == 0}" />
                <h:messages id="errors" globalOnly="true" />
                	<h:panelGroup rendered="#{locationCrud.pager.totalCount > 0}">
                    	<h:dataTable value="#{locationCrud.pagedItems}" var="loc"
                                 width="100%" columnClasses="center,center,center,width3" >
                        <h:column headerClass="width1">
                        	<f:facet name="header">
                            	<h:outputText value="#{msg.locationId}" />
                            </f:facet>
                            <h:outputText value="#{loc.extId}" />
                        </h:column>
                        <h:column headerClass="width1">
                        	<f:facet name="header">
                            	<h:outputText value="#{msg.locationName}" />
                            </f:facet>
                        	<h:outputText value="#{loc.locationName}" />
                        </h:column>
                       	<h:column headerClass="width1">
                           	<f:facet name="header">
                               	<h:outputText value="#{locationHierarchyService.lowestLevel}" />
                        	</f:facet>
                        	<h:outputText value="#{loc.locationLevel}" />
                      	</h:column>
                       	<h:column headerClass="width3">
                           	<f:facet name="header">
                               	<h:outputText escape="false" value=""/>
                           	</f:facet>  
                            	<h:commandLink id="detail" action="location_detail">
                               	<h:graphicImage title="view" style="border: 0;" value="/resources/icons/details.ico"/>
                               	<f:param name="itemId" value="#{loc.uuid}"/>
                            	</h:commandLink>
							<h:outputText value=" "/>
                           	<h:commandLink id="edit" action="location_edit" >
                             		<f:param name="itemId" value="#{loc.uuid}"/>
                             		<h:graphicImage style="border: 0;" title="edit" value="/resources/icons/edit.ico" />
                          		</h:commandLink>
                           	<h:outputText value=" "/>
                           	<h:commandLink action="#{locationCrud.delete}">
	                    		<h:graphicImage title="delete" style="border: 0;" value="/resources/icons/delete.ico"/>
                          	    	<f:param name="itemId" value="#{loc.uuid}"/>
	                		</h:commandLink>
                    	</h:column>
                	</h:dataTable>
            	</h:panelGroup>
        	</c:if>
    	</div>
	</h:form>
</ui:composition>